package com.geilizu.dom.controller;

import com.geilizu.dom.dto.UserInfo;
import com.geilizu.dom.entity.DormitoryAdmin;
import com.geilizu.dom.entity.SystemAdmin;
import com.geilizu.dom.result.ResponseCode;
import com.geilizu.dom.result.ResponseData;
import com.geilizu.dom.service.SystemAdminService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (SystemAdmin)表控制层
 *
 * @author makejava
 * @since 2022-07-12 21:46:39
 */
@RestController
@RequestMapping("systemAdmin")
public class SystemAdminController {
    @Resource
    public SystemAdminService systemAdminService;
    @GetMapping("/login")
    public ResponseData login(UserInfo userInfo) {
        String username = userInfo.getUsername();
        String password = userInfo.getPassword();
        SystemAdmin systemAdmin = systemAdminService.login(username, password);
        if (systemAdmin == null) {
            return new ResponseData(ResponseCode.DATAERROR);
        } else {
            return new ResponseData(ResponseCode.SUCCESS, systemAdmin);
        }
    }

}

